Extension

interface Extension : Advisable<P>

A Chrome extension.

Chrome extensions can be installed and uninstalled via the Extensions service. It is possible to install an extension from CRX files and Chrome Web Store. Each extension is installed on a per-profile basis, and is not shared with other profiles.

Extensions can be installed for incognito profiles. Extensions installed for the default profile in the engine with enableIncognito() option are also installed for the default profile. Extensions installed for the default profile in the engine without enableIncognito() option are not enabled when the engine is launched with this option.

The chrome.declarativeNetRequest API overlaps with JxBrowser network events and callbacks. If there is an extension that uses this API, it gets a chance to handle network requests first. Any changes made by the extension will be visible in the corresponding events and callbacks in JxBrowser. If the request is canceled by an extension, the network callbacks and events will not be invoked in JxBrowser for this request.

There are certain limitations related to Chromium tabs, windows, and other UI elements. The windows.Window is mapped to a native window associated with the browser, not the Java window it is embedded into (if any). Thus, methods and properties of the windows.Window object, such as Window.width, Window.height, Window.focused, etc., are bound to that native window.

From Chromium's perspective, each Browser is a window with one tab. Extensions that manipulate tabs, tab groups, or windows should be used with caution, as they might not work as expected.

Below is the list of Chromium Extension APIs that are not supported in JxBrowser:

  • chrome.tabs.discard.
  • chrome.tabs.remove.
  • chrome.tabs.duplicate.
  • chrome.windows.remove.
  • chrome.windows.update.
  • chrome.window.create with more than one URL in parameters.
  • chrome.sessions.restore.
  • chrome.desktopCapture.chooseDesktopMedia.

If an extension calls an unsupported method that returns a Promise, it will be rejected with an error. If a method accepts a callback, the chrome.runtime.lastError property will be set to an error.

Since

8.0.0

Functions

Link copied to clipboard
abstract fun action(browser: Browser): Optional<ExtensionAction>
Returns the extension action for the given browser or an empty Optional if the extension does not have an action.
Link copied to clipboard
inline fun <C : Callback> Advisable<in C>.callback(): C?
inline fun <C : Callback> Advisable<in C>.callback(): C?

Returns the currently registered callback of type C, if any.

Link copied to clipboard
abstract fun extensions(): Extensions
Returns the Extensions service that manages this extension.
Link copied to clipboard
abstract fun <C : P?> get(callbackClass: Class<C>): Optional<C>
Returns an Optional that contains the callback of the given type or an empty Optional if there is no registered callback with the given type.
Link copied to clipboard
abstract fun id(): String
Returns the ID of this extension.
Link copied to clipboard
abstract fun name(): String
Returns the name of this extension.
Link copied to clipboard
inline fun <C : Callback> Advisable<in C>.register(callback: C): C?
inline fun <C : Callback> Advisable<in C>.register(callback: C): C?

Registers the given callback in this Advisable.

Link copied to clipboard
abstract fun <C : P?> remove(callbackClass: Class<C>): C
Removes a particular service callback.
Link copied to clipboard
inline fun <C : Callback> Advisable<in C>.removeCallback(): C?
inline fun <C : Callback> Advisable<in C>.removeCallback(): C?

Removes a callback of type C from this Advisable, if any.

Link copied to clipboard
abstract fun <C : P?> set(callbackClass: Class<C>, callback: C): C
Sets a particular service callback.
Link copied to clipboard
abstract fun version(): String
Returns the version of this extension.